package org.geometerplus.fbreader.book;

import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.text.view.ZLTextPosition;

import java.util.List;

public interface IBookCollection {
	public enum Status {
		NotStarted(false),
		Started(false),
		Succeeded(true),
		Failed(true);

		public final Boolean IsCompleted;

		Status(boolean completed) {
			IsCompleted = completed;
		}
	}

	public interface Listener {
		void onBookEvent(BookEvent event, Book book);
		void onBuildEvent(Status status);
	}

	public void addListener(Listener listener);
	public void removeListener(Listener listener);

	Status status();

	int size();

	List<Book> books(BookQuery query);
	boolean hasBooks(Filter filter);

	Book getBookByFile(ZLFile file);
	Book getBookById(long id);


	boolean saveBook(Book book, boolean force);
	void removeBook(Book book, boolean deleteFromDisk);

	ZLTextPosition getStoredPosition(long bookId, String chapterId);
	void storePosition(long bookId, String chapterId, ZLTextPosition position);

	
	List<Bookmark> bookmarks(BookmarkQuery query);
	void saveBookmark(Bookmark bookmark);
	void deleteBookmark(Bookmark bookmark);

	HighlightingStyle getHighlightingStyle(int styleId);
	List<HighlightingStyle> highlightingStyles();
	void saveHighlightingStyle(HighlightingStyle style);
}
